package com.googlecode.chigs.web.doku.annotation;

import org.apache.wicket.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.StringResourceModel;

import com.googlecode.chigs.domain.Annotation;

@AuthorizeInstantiation("ROLE_USER")
public class EditAnnotationFormularPanel extends Panel {
	public EditAnnotationFormularPanel(String id, IModel<Annotation> model) {
		super(id);
		StringResourceModel lName = new StringResourceModel("headline.label", EditAnnotationFormularPanel.this, null);
		add(new Label("headline.label", lName));
		add(new TextField<String>("headline", new PropertyModel<String>(model.getObject(), "headline"))
				.setRequired(true)
				.setLabel(lName));

		StringResourceModel lType = new StringResourceModel("text.label", EditAnnotationFormularPanel.this, null);
		add(new Label("text.label", lType));
		add(new TextField<String>("text", new PropertyModel<String>(model.getObject(), "text"))
				.setRequired(true)
				.setLabel(lType));
	}

}
